function [value] = tfc_constrain_table(t,string1,string2,stage,PDG_TFC_parmeters)
    %global PDG_TFC_constant
        % TFC 约束表
    % TFC_constrain_cell = {
    % @(t) 1 + 2*(t-t0_guess)^3/(tf_guess-t0_guess)^3 - 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2, ... % Omega_1(t)
    % @(t) -2*(t-t0_guess)^3/(tf_guess-t0_guess)^3 + 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2, ...   % Omega_2(t)
    % @(t) (t-t0_guess) + (t-t0_guess)^3/((tf_guess-t0_guess)^2 - 2*(t-t0_guess)^2/(tf_guess-t0_guess)), ... % Omega_3(t)
    % @(t) (t-t0_guess)^3/(tf_guess-t0_guess)^2 - (t-t0_guess)^2/(tf_guess-t0_guess); ...           % Omega_4(t)
    
    % @(t) 6*(t-t0_guess)^2/(tf_guess-t0_guess)^3 - 6*(t-t0_guess)/(tf_guess-t0_guess)^2, ...       % d/dt(Omega_1)
    % @(t) -6*(t-t0_guess)^2/(tf_guess-t0_guess)^3 + 6*(t-t0_guess)/(tf_guess-t0_guess)^2, ...      % d/dt(Omega_2)
    % @(t) 1 + 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2 - 4*(t-t0_guess)/(tf_guess-t0_guess), ...     % d/dt(Omega_3)
    % @(t) 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2 - 2*(t-t0_guess)/(tf_guess-t0_guess); ...         % d/dt(Omega_4)
    
    % @(t) 12*(t-t0_guess)/(tf_guess-t0_guess)^3 - 6/(tf_guess-t0_guess)^2, ...               % d^2/dt^2(Omega_1)
    % @(t) -12*(t-t0_guess)/(tf_guess-t0_guess)^3 + 6/(tf_guess-t0_guess)^2, ...              % d^2/dt^2(Omega_2)
    % @(t) 6*(t-t0_guess)/(tf_guess-t0_guess)^2 - 4/(tf_guess-t0_guess), ...                  % d^2/dt^2(Omega_3)
    % @(t) 6*(t-t0_guess)/(tf_guess-t0_guess)^2 - 2/(tf_guess-t0_guess)                       % d^2/dt^2(Omega_4)
    % };
    if(stage == 1)
        t0_guess = PDG_TFC_parmeters.t0_guess;
        tf_guess = PDG_TFC_parmeters.t1;
    elseif(stage == 2)
        t0_guess = PDG_TFC_parmeters.t1;
        tf_guess = PDG_TFC_parmeters.t2;
    elseif(stage == 3)
        t0_guess = PDG_TFC_parmeters.t2;
        tf_guess = PDG_TFC_parmeters.tf_guess;
    else
        disp('Invalid input stage');
    end
    if(~(t>=t0_guess || t <=tf_guess))
        error("TFC_constrain_table_t_error");
    end
    % t0_guess = PDG_TFC_constant.t0_guess;
    % tf_guess = PDG_TFC_constant.tf_guess;
    if string2 == "Initial_Value"
        switch string1
            case '.'
                %value = TFC_constrain_cell{1,1}(t);
                value = 1 + 2*(t-t0_guess)^3/(tf_guess-t0_guess)^3 - 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2;
            case 'd/dt'
                %value = TFC_constrain_cell{2,1}(t);
                value = 6*(t-t0_guess)^2/(tf_guess-t0_guess)^3 - 6*(t-t0_guess)/(tf_guess-t0_guess)^2;
            case 'd^2/dt^2'
                %value = TFC_constrain_cell{3,1}(t);
                value = 12*(t-t0_guess)/(tf_guess-t0_guess)^3 - 6/(tf_guess-t0_guess)^2;
            otherwise
                disp('Invalid input string1');
        end
    elseif string2 == "Final_Value"
        switch string1
            case '.'
                %value = TFC_constrain_cell{1,2}(t);
                value = -2*(t-t0_guess)^3/(tf_guess-t0_guess)^3 + 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2;
            case 'd/dt'
                %value = TFC_constrain_cell{2,2}(t);
                value = -6*(t-t0_guess)^2/(tf_guess-t0_guess)^3 + 6*(t-t0_guess)/(tf_guess-t0_guess)^2;
            case 'd^2/dt^2'
                %value = TFC_constrain_cell{3,2}(t);
                value = -12*(t-t0_guess)/(tf_guess-t0_guess)^3 + 6/(tf_guess-t0_guess)^2;
            otherwise
                disp('Invalid input string1');
        end
    elseif string2 == "Initial_Derivative"
        switch string1
            case '.'
                %value = TFC_constrain_cell{1,3}(t);
                value = (t-t0_guess) + (t-t0_guess)^3/(tf_guess-t0_guess)^2 - 2*(t-t0_guess)^2/(tf_guess-t0_guess);
            case 'd/dt'
                %value = TFC_constrain_cell{2,3}(t);
                value = 1 + 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2 - 4*(t-t0_guess)/(tf_guess-t0_guess);
            case 'd^2/dt^2'
                %value = TFC_constrain_cell{3,3}(t);
                value = 6*(t-t0_guess)/(tf_guess-t0_guess)^2 - 4/(tf_guess-t0_guess);
            otherwise
                disp('Invalid input string1');
        end
    elseif string2 == "Final_Derivative"   
        switch string1
            case '.'
                %value = TFC_constrain_cell{1,4}(t);
                value = (t-t0_guess)^3/(tf_guess-t0_guess)^2 - (t-t0_guess)^2/(tf_guess-t0_guess);
            case 'd/dt'
                value = 3*(t-t0_guess)^2/(tf_guess-t0_guess)^2 - 2*(t-t0_guess)/(tf_guess-t0_guess);
            case 'd^2/dt^2'
                value = 6*(t-t0_guess)/(tf_guess-t0_guess)^2 - 2/(tf_guess-t0_guess);
            otherwise
                disp('Invalid input string1');
        end
    else
        disp('Invalid input string2');
    end
end